<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" encoding="ISO-8859-1" />
	<xsl:template match="/">
		<html>
			<title>Clients</title>
			<link href="../XSL/style.css" rel="stylesheet" type="text/css"
				media="screen" />
			<body>
				<h1>
					Liste des clients de
					<xsl:value-of select="/clients/idGestionnaire" />
				</h1>

				<p>
					<i>
						L'ensemble des montants des comptes gérés par la banque s'élève à
						<b>
							<xsl:value-of select="sum(//montantCompte)" />
							euros
						</b>
						!
					</i>
				</p>
				<br />
				<br />

				<xsl:for-each select="//client">
					<h3>
						<xsl:value-of select="idClient" />
					</h3>

					<ul>
						<li>
							<b>Type : </b>
							<xsl:value-of select="@type" />
						</li>
						<li>
							<b>Montant du compte : </b>
							<xsl:value-of select="montantCompte" />
							€
						</li>
					</ul>

					<xsl:choose>
						<xsl:when test="sum(cheques/cheque) != 0">
							<h2>Chèques</h2>
							<p align="justify">
								<table classe="gridtable">
									<tr>
										<th>ID</th>
										<th>Date d'émission</th>
										<th>Emis</th>
										<th>Montant</th>
										<th>Devise</th>
										<th>Ordre</th>
										<th>Expédié</th>
									</tr>
									<xsl:for-each select="cheques/cheque">
										<tr>
											<td>
												<xsl:value-of select="@idCheque" />
											</td>
											<td>
												<xsl:value-of select="@dateEmission" />
											</td>
											<td>

												<xsl:choose>
													<xsl:when test="@emis = 'false'">
														Non
													</xsl:when>
													<xsl:otherwise>
														Oui
													</xsl:otherwise>
												</xsl:choose>

											</td>
											<td>
												<xsl:value-of select="montant" />
											</td>
											<td>
												<xsl:value-of select="@devise" />
											</td>
											<td>
												<xsl:value-of select="ordre" />
											</td>
											<td>

												<xsl:choose>
													<xsl:when test="@expedie = 'false'">
														Non
													</xsl:when>
													<xsl:otherwise>
														Oui
													</xsl:otherwise>
												</xsl:choose>

											</td>
										</tr>

									</xsl:for-each>
								</table>
							</p>
						</xsl:when>
					</xsl:choose>
				</xsl:for-each>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>